﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GtsServer.Model;
using GtsServer.DAL;
using GtsServer.Common;
using System.Data;

namespace GtsServer.Manage.Controller
{
    public class LotteryPoolController
    {
        LotteryPoolDAL dal = new LotteryPoolDAL();
        public List<LotteryPool> GetList(string strWhere = "")
        {
            DataSet ds = dal.GetList(strWhere);
            return IListDataSet.DataSetToIList<LotteryPool>(ds, 0).ToList();
        }

        public bool Update(LotteryPool model)
        {
            bool isSuccess = dal.Update(model);
            if (isSuccess)
            {
                StartEndTaskService.ServiceClient client = new StartEndTaskService.ServiceClient();
                if (!model.IsOpen.Value)
                    client.EditLotteryPool(0, 0);
                else
                    client.EditLotteryPool(model.EditTime ?? 0, model.EditNum ?? 0);
            }
            return isSuccess;
        }
    }
}
